home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
s-gikan2.maizuru-ct.ac.jp
/
s-gikan2.maizuru-ct.ac.jp.zip
/
s-gikan2.maizuru-ct.ac.jp
/
pub
/
old
/
ncvc350_install.exe
/
{app}
/
scripts
/
by_scale.pl
< prev
next >
Wrap
Perl Script
|
2004-04-02
|
811b
|
32 lines
#! /usr/bin/perl
# NCâfü[â^Æåé╠ì└òWÆlé≡ÆΦé▀é╜öΣùªé╔ò╧è╖é╖éΘâXâNâèâvâg #
# X,Y,Z,I,J,K,R,C,U,V,Wé╠îπé╠ÉöÄÜé¬É▌ÆΦé╡é╜ö{ùªé╔é╚éΘ #
# ö{ùªé≡é⌐é»é╜Ælé¬0ê╚èOé╠É«Éöé╞é╚éΘé╞é½üAżÉöô_é≡òtë┴é╖éΘ #
# ex.(ratio= 2.0;) X50.3Y80Z30. -> X100.6Y160.Z60. #
#######################
#ö{ùªé≡ôⁿéΩé─é¡é╛é│éó
$ratio = 2.0;
#######################
$pre_file= $ARGV[0];
$out_file= $ARGV[1];
open(IN,$pre_file);
open(OUT,">$out_file");
while(<IN>){
if(!/^N?[0-9\s]*[\(\%]/){
$new_line= "";
while(/([XYZIJKRCUVW])([\-\d\.]+)/){
($pre_line,$char,$num,$_)= ($`,$1,$2,$');
$num= int(int($num*1000) * $ratio);
$num= $num/1000;
if($num !~ /\./ and $num != 0){ $num= $num."\."; }
$new_line= $new_line.$pre_line.$char.$num;
}
$_= $new_line.$_;
}
print OUT;
}